﻿namespace dPet.Domain.Models
{
	using Hangerd;
	using Hangerd.Entity;

	public class ServiceSKUPropertyValue : EntityBase
	{
		#region Public Properties

		public ServiceSKUProperty SKUProperty { get; private set; }

		private string _value;

		/// <summary>
		/// SKU属性值
		/// </summary>
		[RecordModify]
		public string Value
		{
			get { return _value; }
			set
			{
				if (string.IsNullOrWhiteSpace(value))
				{
					throw new HangerdException("SKU属性值不可为空");
				}

				_value = value.Trim();
			}
		}

		#endregion

		#region Constructors

		private ServiceSKUPropertyValue() { }

		public ServiceSKUPropertyValue(ServiceSKUProperty skuProperty, string value)
		{
			this.SKUProperty = skuProperty;

			this.SetValue(value);
		}

		#endregion

		#region Public Methods

		public void SetValue(string newValue)
		{
			this.Value = newValue;
		}

		#endregion

		#region Private Methods

		#endregion
	}
}
